package com.venue.hjt.venueclass.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.venue.hjt.venueclass.R;
import com.venue.hjt.venueclass.bean.VenueBooKingDetaitBean;
import com.venue.hjt.venueclass.view.CircleImageView;

import java.util.List;

/**
 * Created by xqx on 2017/10/25.
 * 照片墙
 */

public class VenueSignSuccessAdapter extends BaseAdapter {
    private Context mContext;
    private List<VenueBooKingDetaitBean.Signin> list;

    public VenueSignSuccessAdapter(Context mContext, List<VenueBooKingDetaitBean.Signin> list) {
        this.mContext = mContext;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHander viewHander;
        if (convertView==null){
            viewHander=new ViewHander();
            convertView=View.inflate(mContext, R.layout.venue_sign_success_item,null);
            viewHander.iv_student_url=convertView.findViewById(R.id.iv_student_url);
            viewHander.tv_name=convertView.findViewById(R.id.tv_name);
            convertView.setTag(viewHander);

        }else{
            viewHander= (ViewHander) convertView.getTag();
        }
        VenueBooKingDetaitBean.Signin signin = list.get(position);
        if (signin.headimg!=null){
            Glide.with(mContext).load(signin.headimg).into( viewHander.iv_student_url);
        }
        viewHander.tv_name.setText(signin.name);
        return convertView;
    }
    class ViewHander{
        private TextView tv_name;
        CircleImageView iv_student_url;
    }

    @Override
    public boolean isEnabled(int position) {
        return false;
    }
}
